package com.open.exam.mapper;

import com.open.exam.databasemodel.ExamAdminUser;
import com.open.exam.databasemodel.ExamApp;
import com.open.exam.sqlprovider.ExamAppProvider;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author naicha
 * Created on 2017/11/7.
 */
@Mapper
public interface ExamAdminUserMapper {

    @Insert("INSERT INTO examadminuser (\n" +
            "\tAccount,\n" +
            "\tManagerName,\n" +
            "\tPASSWORD,\n" +
            "\tUpdateTime\n" +
            ") SELECT\n" +
            "\t#{account},\n" +
            "\t#{managerName},\n" +
            "\t#{password},\n" +
            "\tNOW()\n" +
            "FROM\n" +
            "\tDUAL\n" +
            "WHERE\n" +
            "\tNOT EXISTS (\n" +
            "\t\tSELECT\n" +
            "\t\t\t1\n" +
            "\t\tFROM\n" +
            "\t\t\texamadminuser\n" +
            "\t\tWHERE\n" +
            "\t\t\tAccount = #{account}\n" +
            "\t)")
    Integer insert(ExamAdminUser adminUser);
}
